﻿<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPages/Member.master" AutoEventWireup="true"
    CodeFile="FIND-FRIENDS.aspx.cs" Inherits="FIND_FRIENDS" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
<asp:Content ID="Content1" ContentPlaceHolderID="cphHead" runat="Server">
    <script src="Javascripts/jquery/jquery.js" type="text/javascript"></script>
    <style type="text/css">
        .AutoComplete_List
        {
            background-color: #FFF;
            margin: 0px !important;
            border: 1px solid #999;
            cursor: pointer;
            overflow: auto;
            text-align: left;
            list-style-type: none;
            max-height: 200px;
            padding: 0px;
        }
        .AutoComplete_ListItem
        {
            color: #666;
            padding: 0px;
            border-bottom: 1px solid #ddd;
        }
        .AutoComplete_ListItemHilite
        {
            color: #000;
            padding: 0px;
            border-bottom: 1px solid #ddd;
            background-color: #E6E6E6;
        }
        .AutoComplete_ListItemHiliteText
        {
            background-color: #E6E6E6;
            font-size: 15px;
            color: #E7A217;
            font-weight: Bold;
        }
        a.resend
        {
            color: #1C1C1C;
            font-size: 10pt;
        }
        a.resend:link
        {
            text-decoration: none;
        }
        a.resend:hover
        {
            text-decoration: underline;
        }
    </style>
    <script type="text/javascript">
        function ClientPopulated(source, eventArgs) {
            if (source._currentPrefix != null) {
                var list = source.get_completionList();
                var search = source._currentPrefix.toLowerCase();
                for (var i = 0; i < list.childNodes.length; i++) {
                    var text = list.childNodes[i].innerHTML;
                    var index = text.toLowerCase().indexOf(search);
                    if (index != -1) {
                        var value = text.substring(0, index);
                        value += '<span class="AutoComplete_ListItemHiliteText">';
                        value += text.substr(index, search.length);
                        value += '</span>';
                        value += text.substring(index + search.length);
                        list.childNodes[i].innerHTML = value;
                    }
                }
            }
        }
        function ClientItemSelected(source, e) {
            source.get_element().value = (document.all) ? e._item.innerText : e._item.textContent;
        }
    </script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="cphBodyContent" runat="Server">
    <asp:ScriptManager ID="ScriptManager1" runat="server">
    </asp:ScriptManager>
    <table width="100%">
        <tr>
            <td align="right">
                <table>
                    <tr>
                        <td>
                            <asp:TextBox ID="txtSearchFriend" runat="server" Text=" type friend name " onfocus="javascript:clear_textbox();"
                                onblur="javascript:reset_textbox();">            </asp:TextBox>
                            <cc1:AutoCompleteExtender ID="aceSearch" runat="server" TargetControlID="txtSearchFriend"
                                ServiceMethod="GetFriendsList" FirstRowSelected="true" ServicePath="~/Services/wsFriends.asmx"
                                MinimumPrefixLength="1" CompletionSetCount="5" EnableCaching="true" CompletionInterval="300"
                                BehaviorID="bhAutoComplete" OnClientPopulated="ClientPopulated" OnClientItemSelected="ClientItemSelected"
                                CompletionListCssClass="AutoComplete_List" CompletionListItemCssClass="AutoComplete_ListItem"
                                CompletionListHighlightedItemCssClass="AutoComplete_ListItemHilite" UseContextKey="false">
                            </cc1:AutoCompleteExtender>
                        </td>
                        <td align="left" valign="middle">
                            <asp:ImageButton ID="imbSeach" runat="server" ImageUrl="~/Images/search.jpg" OnClick="imbSeach_Click" />
                        </td>
                    </tr>
                </table>
            </td>
        </tr>
        
        <tr>
            <td align="center">
                <table cellpadding="0" cellspacing="0" border="0" width="100%">
                    <tr>
                    <td align="right" valign="middle" style="height:30px; background-color:#FFFFFF;"  colspan="3">
                    <table width="100%">
                    <tr>
                    <td align="left" valign="top" style="width:80%;">
                        <symbonix:ResponseMessage ID="remStatus" runat="server"></symbonix:ResponseMessage></td>
                    <td align="right" valign="top" style="width:80%;"> <strong style="color:#183B62"><asp:Literal ID="litSearchResult" runat="server"></asp:Literal></strong></td>
                    </tr>
                    </table>
               
            </td>
                    </tr>
                      <tr>
                    <td align="right" valign="middle" style="height:5px;colspan="3">
                &nbsp;
            </td>
                    </tr>
                    <asp:Repeater ID="repUsers" runat="server" onitemcommand="repUsers_ItemCommand">
                        <ItemTemplate>
                            <tr>
                                <td align="center" valign="top" style="width:150px;">
                                    <img alt="pic" src='<%# Eval("ImageUrl")==null?Page.ResolveUrl("~/images/no-image.jpg"):Page.ResolveUrl("~/Upload/"+Eval("ImageUrl").ToString())%>' />
                                </td>
                                <td align="left" valign="top" style="width:300px;">
                                    <strong style="color:#326CAE"><%# Eval("UserName")%></strong>
                                    <br />
                                    <%# (Eval("State") != null ? Eval("State").ToString() + ", " : string.Empty) + (Eval("Country") != null ? Eval("Country") .ToString(): string.Empty)%>
                                </td>
                                <td align="center" valign="middle" style="width:100px;">
                                    <asp:ImageButton ID="imbAddFriends" runat="server" ImageUrl="~/Images/add_friend.jpg" CommandArgument='<%# Eval("UserId") %>' CommandName="cmdAddFriends" />
                                </td>
                            </tr>
                            <tr><td colspan="3">&nbsp;</td></tr>
                        </ItemTemplate>
                        <SeparatorTemplate>
                        <tr><td colspan="3" style="background-color: rgb(204, 204, 204); height: 1px;"></td></tr>
                        </SeparatorTemplate>
                    </asp:Repeater>
                </table>
            </td>
        </tr>
    </table>
    <script type="text/javascript">
<!--
        function clear_textbox() {

            var val = $("#<%= txtSearchFriend.ClientID %>").val();
            if (val == " type friend name ")
                $("#<%= txtSearchFriend.ClientID %>").val("");
        }
        function reset_textbox() {

            var val = $("#<%= txtSearchFriend.ClientID %>").val();
            if (val.trim() == "")
                $("#<%= txtSearchFriend.ClientID %>").val(" type friend name ");
        } 
-->
    </script>
</asp:Content>
